<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>${message("电子锁列表")}</title>
<link href="/resources/css/common.css" rel="stylesheet" type="text/css" />
<link href="/resources/css/zTreeStyle.css" rel="stylesheet" type="text/css">
<link href="/resources/css/layout.css" rel="stylesheet" type="text/css" />
<link href="/resources/css/mmGrid.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/resources/js/reference/jquery.js"></script>
<script type="text/javascript" src="/resources/js/base/dialog.js"></script>
<script type="text/javascript" src="/resources/js/reference/jquery.validate.js"></script>
<script type="text/javascript" src="/resources/js/base/request.js"></script>
<script type="text/javascript" src="/resources/js/base/global.js"></script>
<script type="text/javascript" src="/resources/js/reference/mmGrid.js"></script>
<script type="text/javascript" src="/resources/plugin/datePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/resources/js/reference/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript">
function edit(id){
	parent.change_tab(0,'edit.jhtml?id='+id+'&isCheck=${isCheck}');
}
$().ready(function() {
	var $buildForm = $("#buildForm");
	var $member_id = $("#member_id");
	// 表单验证
	$buildForm.validate({
		rules: {
			memberIds: "required"
		},
		submitHandler: function(form) {
			form.submit();
		}
	});
	
	$("#selectStore").bindQueryBtn({
		type:'store',
		title:'${message("查询客户")}',
		url:'/member/store/select_store.jhtml'
	});
	
	//查询价格等级
	$("#selectMemberRank").bindQueryBtn({
		type:'memberRank',
		title:'${message("查询价格等级")}',
		url:'/basic/member_rank/select_memberRank.jhtml'
	});
	
	var rules={0:"${message("围栏内操作")}",1:"${message("围栏外操作")}"};
	var types={0:"${message("圆")}",1:"${message("多边形")}"};
	var cols = [
		{ title:'${message("名称")}', name:'name' ,align:'center',renderer:function(val,item,rowIndex){
			return '<a href="javascript:void(0);" onClick="edit('+item.id+')" class="red">'+val+'</a>';
		}},
		//{ title:'${message("机构名称")}', name:'sale_org_name' ,align:'center' },
		{ title:'${message("类型")}', name:'type' ,align:'center',renderer:function(val,item,rowIndex){
			return types[val];
		}  },
		{ title:'${message("位置")}', name:'points' ,align:'center' },
		{ title:'${message("圆心经度")}', name:'longitude' ,align:'center' },
		{ title:'${message("圆心纬度")}', name:'latitude' ,align:'center' },
		{ title:'${message("半径(米)")}', name:'radius' ,align:'center' },
		{ title:'${message("判断规则")}', name:'judgment_rule' ,align:'center',renderer:function(val,item,rowIndex){
			return rules[val];
		} },
		{ title:'${message("备注")}', name:'remark' ,align:'center' },
		
	];
	$mmGrid = $('#table-m1').mmGrid({
		autoLoad:true,
        cols: cols,
        fullWidthRows:true,
        url: 'list_data.jhtml',
        params:function(){
        	return $("#listForm").serializeObject();
        },
		plugins : [
            $('#paginator').mmPaginator()
        ]
    });
});

function eleF_import(e){
	excel_import(e,{
		title:'${message("电子围栏导入")}',
		url:'import_excel.jhtml',
		template:'/resources/template/electronicFence/electronicFence.xls',
		callback:function(){
			$("#searchBtn").click();
		
		}
	});
}

//条件导出		    
function segmentedExport(e){
	var needConditions = true;//至少一个条件
	var page_url = 'to_condition_export.jhtml';//分页导出统计页面
	var url = 'condition_export.jhtml';//导出的方法
	conditions_export(e,{needConditions:needConditions,page_url:page_url,url:url});
}

//选择导出
function exportExcel(t){
	var param = $mmGrid.serializeSelectedIds();//参数
	var tip = '${message("请选择导出的用户！")}';//提示
	var url = 'selected_export.jhtml';//导出的方法
  	select_export(t,{tip:tip, param:param, url:url});
}

</script>
<script type="text/javascript">
$().ready(function(e) {
 	var zTree = $("#js-menu").initTree({
		url:"/saleOrg/getNodes.jhtml",
		onClick:function(e,treeId, treeNode) {
			$("#saleOrgId").val(treeNode.oid);
		    if(treeNode.id==""){
		  		$("#saleOrgName").val("");
		    }else{
		  		$("#saleOrgName").val(treeNode.name);
		    }
		    $("#searchBtn").click();
		},
		onAsyncSuccess: function(e, treeId, treeNode) {
			var rootNodes = zTree.getNodes();
		 	for (var i = 0; i < rootNodes.length; i++) {
		 		zTree.expandNode(rootNodes[i],true,false,false);
		 	}
		}
	})
    zTree.addNodes(null,{'id':'','pId':'','name':'全部机构','isParent':false});
 	treeScoll();
}); 
</script>
</head>
<body >
<!-- <div class="subnav">
	<input type="hidden" id="flag" value="0">
	<input type="hidden" id="storeId" value="">
 	<div class="tit"><s></s>机构分类</div>
  	<div class="subn-list ztree" id="js-menu">
  	</div>
</div> 
<label id="labBtn"></label> 
<div class="main-right"> -->
	<form id="listForm" action="list.jhtml" method="get">
		<div class="bar">
			<div class="buttonWrap">
			
			<a href="javascript:;" onclick="parent.change_tab(0,'add.jhtml',1)" class="iconButton" id="addButton">
				<span class="addIcon">&nbsp;</span>新增电子围栏
			</a>
			
			[#--
			<a href="javascript:void(0);" id="importButton" class="iconButton" onclick="eleF_import(this)">
				<span class="importIcon">&nbsp;</span>${message("导入")}
			</a>
			<a href="javascript:;" id="export1Button" onclick="segmentedExport(this)" class="iconButton">
					<span class="exportIcon">&nbsp;</span>${message("条件导出")}
			</a>
			--]
			<!--
			<div class="flag-wrap flagImp-wrap">
					<a href="javascript:void(0);" class="iconButton" id="export1Button">
						<span class="impIcon">&nbsp;</span>导入导出
					</a>
					<ul class="flag-list">
						<li><a href="javascript:void(0)" onclick="member_import(this)"><i class="flag-imp01"></i>${message("导入")}</a></li>
						<li><a href="javascript:void(0)" onclick="exportExcel(this)"><i class="flag-imp02"></i>${message("选择导出")}</a></li>
						<li><a href="javascript:void(0)" onclick="segmentedExport(this)"><i class="flag-imp02"></i>${message("条件导出")}</a></li>
					</ul>
				</div>
			-->
		</div>
		<div class="search-btn">
			<a href="javascript:;" id="searchBtn" class="iconButton">${message("1004")}</a>
		</div>
		<div id="searchDiv">
			 <div id="search-content" >
			 	<!-- <dl>
					<dt><p>${message("机构名称")}:</p></dt>
					<dd>
						<input type="hidden" id="saleOrgId" name="saleOrgId"  class="text" value="" />
						<input type="text"  class="text" id="saleOrgName" value="" readOnly/>
					</dd>
				</dl> -->
			 	
        		<dl>
    				<dt ><p>名称:</p></dt>
	    			<dd >
	    				<input type="text" class="text" id="name" name="name"  btn-fun="clear"/>
	    			</dd>
	    		</dl>
	    		<!--
	    		<dl>
				<dt ><p>车牌号:</p></dt>
    			<dd >
    				<input type="text" class="text" id="carNumber" name="carNumber"  btn-fun="clear"/>
    			</dd>
	    		</dl>
	    		<dl>
	    			<dt><p>备注:</p></dt>
	    			<dd>
	    				<input type="text" class="text" id="remark" name="remark"  btn-fun="clear"/>
	    			</dd>
	    		</dl>
	    		
	    		<dl>
        			<dt><p>${message("16015")}:</p></dt>
        			<dd class="date-wrap">
						<input id="startTime" name="startTime" class="text" value="" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd',startDate:'%y-%M-%d', maxDate: '#F{$dp.$D(\'endTime\')}'});" type="text" btn-fun="clear"/>
						<div class="fl">--</div>
						<input id="endTime" name="endTime" class="text" value="" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd',startDate:'%y-%M-%d', maxDate: '#F{$dp.$D(\'endTime\')}'});" type="text" btn-fun="clear"/>
					</dd>
        		</dl>
        		-->
        	</div>
		</div>
		</div>
		<div class="table-responsive">
			<table id="table-m1"></table>
	    	<div id="body-paginator" style="text-align:left;">
	    		<div id="paginator"></div>
	   		</div>
		</div>
	</form>
</body>
</html>